import { post } from './index'

export default function (data) {
  return new Promise(async (res, rej) => {
    try {
      const { data: resData } = await post(`/admin/survey/create`, data)
      console.log('debugger: ', resData)
      if (resData.msg === 'success') {
        res({ status: 'success', id: resData.survey_id })
      }
      rej({ status: 'error', data: resData.msg })
    } catch (error) {
      rej(error)
    }
  })
}
